@extends('admin.common.layout')
@section('admin')
<table id="appGroupTable"></table>
<div id="appGroupToolBar" style="padding:10px">
<form id="fm-app-group" action="###" method="get">

  <label class="l-btn-disabled">&nbsp;&nbsp;名&nbsp;&nbsp;称：</label><input  class="textbox" type="text" name="name" placeholder="请输入..." style="width:150px;padding:5px;"/>
  <label class="l-btn-disabled">&nbsp;&nbsp;应&nbsp;&nbsp;用：</label>
  <select class="easyui-combobox" name="app_id" style="width:150px;height:28px;">
    <option value="">请选择</option>
    @foreach($data['apps'] as $app)
     @if($data['app_id'] == $app['id'])
     <option selected="selected" value="{{$app['id']}}">{{$app['name']}}</option>
     @else
     <option value="{{$app['id']}}">{{$app['name']}}</option>
     @endif
    @endforeach
  </select>
  <label class="l-btn-disabled">&nbsp;&nbsp;状&nbsp;&nbsp;态：</label>
  <select class="easyui-combobox" name="status" style="width:150px;height:28px;">
    <option value="0">请选择</option>
    <option value="1">正常</option>
    <option value="2">禁用</option>
  </select>
  <input  class="textbox" type="hidden" name="type" value="ajax" />
  <button  type="button" class="easyui-linkbutton" iconCls="icon-search" onClick='appGroupObj.search();'>查询</button>
  <button  type="button" class="easyui-linkbutton" iconCls="icon-reload" onClick='appGroupObj.reset();'>重置</button>
  <a class="easyui-linkbutton" iconCls="icon-20130406015709810_easyicon_net_16" onClick='commonObj.reload();'>重载</a>
  <a class="easyui-linkbutton" iconCls="icon-group_add" plain="false" data="{{json_encode(['id'=>0,'name'=>'权限分组','app_id'=>$data['app_id']])}}" onClick='appGroupObj.add(this);'>新增分组</a>
</form>
</div>
<div id="dlg-app-group-add" class="easyui-dialog" style="width:400px" closed="true" buttons="#dlg-app-group-add-buttons">
	<form id="fm-app-group-add" method="get">
	<div style="margin:0;padding:20px 25px">
	<div style="margin-bottom: 10px;">
	<label class="textbox-label">应用名称：</label>
	<select id="app-group-add-app_id" class="easyui-combobox" name="app_id" style="width:50%;">
	<option value="0">请选择应用</option>
	@foreach($data['apps'] as $app)
	<option value="{{$app['id']}}">{{ $app['name'] }}</option>
	@endforeach
	</select>
	</div>
    <div style="margin-bottom:10px">
	<input id="app-group-add-name" name="name" class="easyui-textbox"  required="true" label="分组名称:" style="width:90%">
	</div>
	<div style="margin-bottom:10px">
	<label class="textbox-label">分组权限：</label>
	<input id="app-group-add-auth_id" name="auth_id[]">
	</div>
	<div style="margin-bottom:10px">
	<input id="app-group-add-desc" name="desc" class="easyui-textbox" required="true" multiline=true label="分组描述:" style="width:90%;height:50px;">
	</div>
	</div>
	</form>
</div>
<div id="dlg-app-group-add-buttons">
<a class="easyui-linkbutton" iconCls="icon-page_save" onclick="appGroupObj.save(this);">保存数据</a>
<a class="easyui-linkbutton" iconCls="icon-page_cancel" onclick="appGroupObj.cancel(this);">放弃操作</a>
</div>

<div id="dlg-app-group-edit" class="easyui-dialog" style="width:400px" closed="true" buttons="#dlg-app-group-edit-buttons">
  <form id="fm-app-group-edit" method="get">
   <div style="margin:0;padding:20px 25px">
	<div style="margin-bottom:10px;display:none;">
	<input type="hidden" id="app-group-edit-id" name="id" class="easyui-textbox" abel="分组ID:" style="width:90%">
	</div>
	<div style="margin-bottom:10px;display:none;">
	<input type="hidden" id="app-group-edit-is_show" name="is_show" class="easyui-textbox" label="分组状态:" style="width:90%">
	</div>
	<div style="margin-bottom:10px;display:none;">
	<input type="hidden" id="app-group-edit-status" name="status" class="easyui-textbox" label="分组状态:" style="width:90%">
	</div>
	<div style="margin-bottom: 10px;">
	<label class="textbox-label">应用名称：</label>
	<select id="app-group-edit-app_id" class="easyui-combobox" name="app_id" style="width:50%;">
	<option value="">请选择应用</option>
	@foreach($data['apps'] as $app)
	<option value="{{$app['id']}}">{{ $app['name'] }}</option>
	@endforeach
	</select>
	</div>
	<div style="margin-bottom:10px">
	<input id="app-group-edit-name" name="name" class="easyui-textbox"  required="true" label="分组名称:" style="width:90%">
	</div>
	<div style="margin-bottom:10px">
	<label class="textbox-label">分组权限：</label>
	<input id="app-group-edit-auth_id" name="auth_id[]">
	</div>
	<div style="margin-bottom:10px">
	<input id="app-group-edit-desc" name="desc" class="easyui-textbox" required="true" multiline=true label="分组描述:" style="width:90%;height:50px;">
	</div>
   </div>
  </form>
</div>
<div id="dlg-app-group-edit-buttons">
<a class="easyui-linkbutton" iconCls="icon-page_save" onclick="appGroupObj.modify(this);">保存数据</a>
<a class="easyui-linkbutton" iconCls="icon-page_cancel" onclick="appGroupObj.cancel(this);">放弃操作</a>
</div>
<script>
require(['pages/admin/app/app','pages/common/common'],function(appGroup,common){
common.init({});
appGroup.appGroupInit({
	get_app_json:'{!! $data["appJson"] !!}',
	get_list_url:"{{ route('admin.app.group')}}",
	get_add_url:"{{ route('admin.app.group.add')}}",
	get_edit_url:"{{ route('admin.app.group.edit')}}",
	get_auth_url:"{{ route('admin.app.auth')}}",
	get_group_auth_url:"{{ route('admin.app.group.auth')}}",
  });
});
</script>
@stop
